import type { DepartData, OrderDetail, OrderEvaluateParam, OrderPreData, OrderPreParams } from '@/types/consult'
import type { illnessInfoData } from '@/types/description'
import { request } from '@/utils/request'

//获取科室列表
export const getDepartmentListApi = () => {
  return request.get<null, DepartData[]>('/dep/all')
}

/**
 * 生成预支付订单
 */
export const createConsultOrderApi = (params: OrderPreParams) => {
  return request.get<null, OrderPreData>('/patient/consult/order/pre', { params })
}

/**
 * 问诊-保存/修改问诊订单(创建订单 -> 返回订单id -> 支付)
 */
export const saveConsultOrderApi = (data: illnessInfoData) => {
  return request.post<null, { id: string }>('/patient/consult/order', data)
}

/**
 * 问诊订单详情
 */
export const orderDetailApi = (orderId: string) => {
  return request.get<null, OrderDetail>('/patient/consult/order/detail', { params: { orderId } })
}

/**
 * 问诊订单评价
 */
export const orderEvaluateApi = (data: OrderEvaluateParam) => {
  return request.post<null, { id: string }>('/patient/order/evaluate', data)
}
